package com.java.boot.auto;

import com.java.boot.properties.HelloProperties;
import com.java.boot.service.HelloService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author jingjintao
 * @date 2021/8/1 - 18:14
 **/
@Configuration
@EnableConfigurationProperties(HelloProperties.class)   //默认HelloProperties放在容器中
public class HelloServiceAutoConfiguration {

    @ConditionalOnMissingBean(HelloService.class)
    @Bean
    public HelloService helloService(){
        HelloService helloService = new HelloService();
        return helloService;
    }
}
